<script lang="ts" setup>
	import AppProvider from '@/components/AppProvider/index.vue';
	import Iconify from '@/components/Iconify/index.vue';
	import { Toast } from '@/utils/uniapi/prompt';
	import { useAuthStore } from '@/state/modules/auth';
	import { useUserStore } from '@/state/modules/user';

	const authStore = useAuthStore();
	const userStore = useUserStore();
	const isLogin = ref(false);
	const router = useRouter();

	// 跳转
	const handleJump = (url : string) => {
		router.push(url);
	};

	// 登出
	const handleLoginOut = () => {
		authStore.loginOut().then(() => {
			isLogin.value = false;
			router.pushTab({ path: '/pages/index/index' });
		});
	};

	function handleToUpgrade() {
		Toast('模块建设中~')
	};

	function handleCleanTmp() {
		Toast('模块建设中~')
	};

	onLoad(() => {
	});

	onShow(() => {
		isLogin.value = authStore.isLogin;
	});
</script>
<template>
	<view class="container">
		<view class="menu-list">
			<view class="list-cell list-cell-arrow" @click="handleJump('/pages/mine/pwd/index')">
				<view class="menu-item-box">
					<view class="iconfont icon-password menu-icon"></view>
					<view>修改密码</view>
				</view>
			</view>
			<view class="list-cell list-cell-arrow" @click="handleToUpgrade">
				<view class="menu-item-box">
					<view class="iconfont icon-refresh menu-icon"></view>
					<view>检查更新</view>
				</view>
			</view>
			<view class="list-cell list-cell-arrow" @click="handleCleanTmp">
				<view class="menu-item-box">
					<view class="iconfont icon-clean menu-icon"></view>
					<view>清理缓存</view>
				</view>
			</view>
		</view>
		<view class="cu-list menu">
			<view class="cu-item item-box">
				<view class="content text-center" @click="handleLoginOut">
					<text class="text-black">退出登录</text>
				</view>
			</view>
		</view>
	</view>
</template>

<style lang="scss" scoped>
	.page {
		background-color: #f8f8f8;
	}

	.item-box {
		background-color: #FFFFFF;
		margin: 30rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		padding: 10rpx;
		border-radius: 8rpx;
		color: #303133;
		font-size: 32rpx;
	}
</style>